package Graph.graphWithWeight;

public class EdgeWeight implements Comparable<EdgeWeight>{

    private int v, w,weight;

    public EdgeWeight(int v, int w,int weight){
        this.v = v;
        this.w = w;
        this.weight = weight;
    }

    public int getV(){
        return this.v;
    }

    public int getW(){
        return this.w;
    }

    public int getWeight(){
        return this.weight;
    }

    @Override
    public int compareTo(EdgeWeight another) {
        //如果返回的是一个负数  表示当前的这个对象 比参数传进来的这个对象要 小
        //如果返回的是一个正数  表示当前的这个对象 比参数传进来的这个对象要 大
        return this.weight - another.weight;
    }

    @Override
    public String toString(){
        return String.format("%d-%d: %d", v, w,weight);
    }
}
